import React from 'react';
import { Modal, Form } from 'antd';
import FormCondition from '@/components/FormCondition';
import TableDataBlock from '@/components/TableDataBlock';
const RefuseModal = (props) => {
  const { visible = false, onClose, loading, list, dispatch, handleCallback, selectedKeys } = props;
  const modalProps = {
    title: `关联人员`,
    width: 650,
    visible: visible,
    maskClosable: true,
    destroyOnClose: true,
    zIndex: 1001,
    confirmLoading: loading,
    footer: null,
    onCancel: onClose,
  };

  return (
    <Modal {...modalProps}>
      <TableDataBlock
        loading={loading}
        noCard={true}
        order
        columns={[
          {
            title: '姓名',
            dataIndex: 'username',
          },
          {
            type: 'handle',
            width: 200,
            dataIndex: 'id',
            render: (val, record) => [
              {
                type: 'del',
                click: () => {
                  dispatch({
                    type: 'system/fetchDeleteRoleAdmin',
                    payload: {
                      id: Number(selectedKeys),
                      adminIdList: [val]
                    },
                    callback: () => {
                      handleCallback && handleCallback()
                    }
                  })
                },
              },
            ],
          }
        ]}
        rowKey={(record) => `${record.username}`}
        list={list}
      ></TableDataBlock>
    </Modal>
  );
};

export default RefuseModal;
